#include<iostream>
using namespace std;
const int N = 1e4 + 10;
int arr[N];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i != arr[i]) {
			for (int j = 1; j <= n; j++) {
				if (arr[j] == i) {
					swap(arr[i], arr[j]);
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}